<?php
require_once(dirname(dirname(__FILE__)) . '/app.php');

need_partner();

$action = strval($_GET['action']);
$id = abs(intval($_GET['id']));

if ( 'orderview_biz' == $action) {
	$order = Table::Fetch('order', $id);
	$user = Table::Fetch('user', $order['user_id']);
	$team = Table::Fetch('team', $order['team_id']);
	if ($team['delivery'] == 'express') {
		$option_express = option_category('express');
	}
	$payservice = array(
		'alipay' => '支付宝',
		'tenpay' => '财付通',
		'chinabank' => '网银在线',
		'credit' => '余额付款',
		'cash' => '线下支付',
	);
	$paystate = array(
		'unpay' => '<font color="green">未付款</font>',
		'pay' => '<font color="red">已付款</font>',
	);
	$html = render('biz_ajax_dialog_orderview');
	json($html, 'dialog');
}

else if ( 'orderexpress' == $action ) {
	//need_auth('order');
	$express_id = abs(intval($_GET['eid']));
	$express_no = strval($_GET['nid']);
	if (!$express_id) $express_no = null;
	Table::UpdateCache('order', $id, array(
		'express_id' => $express_id,
		'express_no' => $express_no,
	));
	json(array(
		array('data' => "修改快递信息成功", 'type'=>'alert'),
		array('data' => null, 'type'=>'refresh'),
	 ), 'mix');
}